<?php

namespace app\admin\validate;

use think\Validate;

class Gateway extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => 'require|max:50|unique:gateway,name',
        'username' => 'require|max:50|unique:gateway,username',
        //'password' => 'require|max:50',
    ];
    /**
     * 提示消息
     */
    protected $message = [
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        //'add'  => ['name', 'username', 'password'],
        'add'  => ['name', 'username'],
        'edit' => ['name', 'username'],
    ];

    public function __construct(array $rules = [], $message = [], $field = []) {

        $this->field = [
            'name' => __('线路名称'),
            'username' => __('注册用户名'),
            'password' => __('注册密码')
        ];
        parent::__construct($rules, $message, $field);

    }
    
}
